| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

UniquePtr.h
1 // UniquePtr.h
3 //
5
6 namespace nkMemory
7 {
15 template <typename T>
16 class UniquePtr
17 {
18 public :
19
20 // Constructors
24 UniquePtr () noexcept ;
33 UniquePtr (T* data) noexcept ;
42 template <typename U, typename = std::enable_if_t<std::is_base_of_v<T, U>>>
43 UniquePtr (U* data) noexcept ;
49 UniquePtr (const UniquePtr<T>& other) = delete ;
55 UniquePtr (UniquePtr<T>&& other) noexcept ;
61 template <typename U, typename = std::enable_if_t<std::is_base_of_v<T, U>>>
62 UniquePtr (UniquePtr<U>&& other) noexcept ;
63
64 // Destructor
68 ~UniquePtr () ;
69
70 public :
71
72 // Getters
78 T* get () const ;
79
83 bool empty () const ;
84
85 public :
86
87 // Management
91 T* release () ;
92
98 void reset (T* data = nullptr) ;
99
100 public :
101
102 // Operators
108 T& operator* () ;
109
115 const T& operator* () const ;
116
122 T* operator-> () ;
123
129 const T* operator-> () const ;
130
137 UniquePtr<T>& operator= (const UniquePtr<T>& other) = delete ;
138
145 UniquePtr<T>& operator= (UniquePtr<T>&& other) noexcept ;
146
150 operator bool () const ;
151
157 bool operator! () const ;
158
162 operator std::unique_ptr<T> () ;
163
168 template <typename U, typename = std::enable_if_t<std::is_base_of_v<U, T>>>
169 operator std::unique_ptr<U> () ;
170
171 public :
172
173 // Templated constructors
179 UniquePtr (std::unique_ptr<T> stdPtr) noexcept ;
180
187 template <typename U, typename = std::enable_if_t<std::is_base_of_v<T, U>>>
188 UniquePtr (std::unique_ptr<U> stdPtr) noexcept ;
189 } ;
190
191 // Emulation
198 template <typename T, typename... Args>
199 static UniquePtr<T> makeUnique (Args&&... args) ;
200 }
nkMemory::UniquePtr::UniquePtr
UniquePtr() noexcept
nkMemory::UniquePtr::release
T * release()
nkMemory::UniquePtr::get
T * get() const
nkMemory::UniquePtr::empty
bool empty() const
nkMemory::UniquePtr
Smart pointer owning the object instance it encapsulates.
Definition: UniquePtr.h:17
nkMemory::UniquePtr::reset
void reset(T *data=nullptr)
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7